package com.revzone.demo001.entity;

import lombok.Data;
import org.aspectj.bridge.IMessage;

@Data
public class Result {
    private Integer code;

    private String msg;

    private Object data;

    public Result() {

    }
    public Result(Integer code, String msg, Object data) {
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    public static Result success() {
        return new Result(200,"success",null);
    }
    public static Result success(String mgs, Object object) {
        return new Result(202,mgs,object);
    }
    public static Result success(Integer code, String mgs, Object object) {
        return new Result(code,mgs,object);
    }
    public static Result success(Object object) {
        return new Result(200,"success",object);
    }


    public static Result error() {
        return new Result(500,"未知异常，请联系管理员",null);
    }
    public static Result error(String msg) {
        return new Result(500,msg,null);
    }
    public static Result error(Integer code,String msg) {
        return new Result(code,msg,null);
    }

    // *** 确保有这些 Getter 方法 ***
    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public Object getData() { // 这个就是你需要的！
        return data;
    }

    // （可选）Setter 方法，如果需要的话
    public void setCode(Integer code) {
        this.code = code;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public void setData(Object data) {
        this.data = data;
    }

}
